import type { RangePickerProps } from 'antd/es/date-picker';
import dayjs from 'dayjs';

// 开始时间禁用
const disabledDate: RangePickerProps['disabledDate'] = (current) => {
    // 今天之前的都不可以选
    return current && current < dayjs().subtract(1, 'days').endOf('day');
};

export const formList = [
    {
        label: '用户名',
        name: 'username',
        type: 'input',
        maxLength: 12,
        required: true,
        span: 12,
    },
    {
        label: '用户手机号',
        name: 'phone',
        type: 'input',
        maxLength: 11,
        required: true,
        span: 12,
    },
    {
        label: '计划名',
        name: 'planName',
        type: 'input',
        maxLength: 12,
        required: true,
        span: 12,
    }, {
        slot: 'planType',
        span: 12,
        required: true,
    }, {
        label: '时间线',
        name: 'timeLine',
        type: 'dataPickerRange',
        required: true,
        span: 20,
        disabledDate: disabledDate,
    }
    , {
        label: '状态',
        name: 'achieveStatus',
        type: 'select',
        options: [
            { value: '0', label: '未开始' },
            { value: '1', label: '进行中' },
            { value: '2', label: '已完成' },
            { value: '3', label: '已失效' },
        ],
        required: true,
        span: 12,
    },
    {
        label: '备注',
        name: 'notes',
        type: 'textArea',
        span: 24,
    },
]

